<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!--JSTL core tag need to add jstl 1.2 jar to lib-->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head><title>Struts 1 Training Materials</title>
</head>

<body>
<c:set var="root" value="${pageContext.request.contextPath}"/>
<div align="center">
    <center>
        <table border="1" cellspacing="1" width="400">
            <tr>
                <td width="390"><font size="4"><b>Struts 1 Components and Work Flow</b></font></td>
            </tr>
            <tr>
                <td width="384">
                    <ul>
                        <li>
                            <a href="#">Struts working</a>
                            <br>
                             <img src="../../images/struts-flow.gif" border="0">
                        </li>

                        <li>
                            <a href="#">Process flow</a>
                            <br>
                            <b>web.xml : </b>Whenever the container gets start up the first work it does is to check the web.xml (deployment descriptor) file and determine what struts action Servlets exist.
                            The container is responsible for mapping all the file request to the correct action Servlet.
                            In the WEB-INF/web.xml we define the struts ActionServlet which extends from HttpServlet. When the container stats up the init() method will pass the struts configuration
                            file (struts.config.xml) and loads it into the memory. When a HTTP request comes it intercepts in doGet() and doPost() method and handles it appropriately.
                            URL pattern - we have to tell the container which type of request we need to forward to ActionServlet. ex: http://localhost/struts1/login.do
                            <br>
                            <b>A Request : </b>This is the second step performed by the container after checking the web.xml file. In this the user submits a form within a browser and the request is intercepted by the controller.
                            <br>
                            <b>The Controller : </b>This is the heart of the container. Most Struts application will have only one controller that is ActionServlet which is responsible for directing several Actions. The controller determines what action is required and sends the information to be processed by an action Bean. The key advantage of having a controller is its ability to control the flow of logic through the highly controlled, centralized points.
                            <br>
                            <b>struts.config.xml : </b>Struts has a configuration file to store mappings of actions. By using this file there is no need to hard code the module which will be called within a component. The one more responsibility of the controller is to check the struts.config.xml file to determine which module to be called upon an action request. Struts only reads the struts.config.xml file upon start up.
                            <br>
                            <b>Model : </b>The model is basically a business logic part which takes the response from the user and stores the result for the duration of the process. This is a great place to perform the preprocessing of the data received from request. It is possible to reuse the same model for many page requests. Struts provides the ActionForm and the Action classes which can be extended to create the model objects.
                            <br>
                            <b>View : </b>The view in struts framework is mainly a jsp page which is responsible for producing the output to the user.
                            <br>
                            <b>Struts tag libraries : </b>These are struts components helps us to integrate the struts framework within the project's logic. These struts tag libraries are used within the JSP page. This means that the controller and the model part can't make use of the tag library but instead use the struts class library for strut process control.
                            <br>
                            <b>Property file : </b>It is used to store the messages that an object or page can use. Properties files can be used to store the titles and other string data. We can create many property files to handle different languages.
                            <br>
                            <b>Business objects :  </b>It is the place where the rules of the actual project exists. These are the modules which just regulate the day- to- day site activities.
                            <br>
                            <b>The Response : </b> This is the output of the View JSP object.
                        </li>
                    </ul>
                </td>
            </tr>
            <tr>
                <td>
                    <a href="${root}/index.jsp">HOME</a>
                </td>
            </tr>
        </table>
    </center>
</div>
</body>
</html>